package com.jjb.www.ui.dialog;

import android.content.Context;
import android.text.Html;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;

import com.blankj.utilcode.util.SPUtils;
import com.hjq.base.BaseDialog;
import com.hjq.shape.view.ShapeCheckBox;
import com.hjq.shape.view.ShapeImageView;
import com.hjq.shape.view.ShapeTextView;
import com.jjb.www.R;
import com.jjb.www.aop.SingleClick;
import com.jjb.www.other.AppConfig;

import java.util.List;


/**
 * author : Android
 * time   : 2019/03/20
 * desc   : 规则Dialog
 */
public final class LearningDialog {

    public static final class Builder
            extends BaseDialog.Builder<Builder> {
        @Nullable
        private OnListener mListener;
        private ShapeImageView mImgFish;
        private ShapeTextView mTvAuthorization;
        private ShapeCheckBox mCkTos;



        public Builder(Context context) {
            super(context);
            setContentView(R.layout.dialog_learning);
            mImgFish = findViewById(R.id.img_fish);
            mTvAuthorization = findViewById(R.id.tv_authorization);
            mCkTos = findViewById(R.id.ck_tos);
            setAnimStyle(BaseDialog.ANIM_BOTTOM);
            setCancelable(true);
            setOnClickListener(mTvAuthorization, mImgFish);
        }

        public Builder setListener(OnListener listener) {
            mListener = listener;
            return this;
        }


        /**
         * 设置提示
         */
        public Builder setHint(CharSequence hint) {
            return this;
        }

        @SingleClick
        @Override
        public void onClick(View view) {
            if (view == mTvAuthorization) {
                if (mCkTos.isChecked()){
                    SPUtils.getInstance().put("Checked",true);
                }
                dismiss();
            } else if (view == mImgFish) {
                dismiss();
            }
        }
    }
    public interface OnListener {
        void onCompleted(BaseDialog dialog);
        void onCancel(BaseDialog dialog);
    }
}